//
//  ViewController.m
//  06-UI
//
//  Created by Snow on 16/7/21.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "ViewController.h"
#import "CycleScrollView.h"

#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
#define kScreenBounds [UIScreen mainScreen].bounds

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:@[@"消息", @"电话"]];
    segment.frame = CGRectMake(0, 0, 150, 40);
    segment.layer.masksToBounds = YES;
    segment.layer.cornerRadius = 8;
    self.navigationItem.titleView = segment;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.094 green:0.659 blue:0.957 alpha:1.000];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1"]];
    image.frame = CGRectMake(0, 0, 40, 40);
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:image];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleAdd:)];
    self.navigationController.navigationBar.translucent = NO;
    NSArray *array = @[@"2", @"3", @"4", @"5", @"6"];
    CycleScrollView *images = [[CycleScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)];
    images.scrollView.showsHorizontalScrollIndicator = YES;
    [images setImagesWithArray:array];
    [self.view addSubview:images];

    
    
    
}

- (void)handleAdd:(UIBarButtonItem *)button
{
    NSLog(@"你点击了添加联系人");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
